#include<iostream>
#include<signal.h>
#include<unistd.h>

using namespace std;

void sigcb(int signum)
{
    cout<<"receive signal:"<<signum<<endl;
    exit(-1);
}

int main()
{
    struct sigaction s;
    s.sa_handler=sigcb;
    sigaction(SIGINT,&s,NULL);
    while(true)
    {
        cout<<"pid:"<<getpid()<<endl;
        sleep(1);
    }
    return 0;
}